package cn.enilu.flash.bean.entity.park;

import cn.enilu.flash.bean.entity.BaseEntity;
import lombok.Data;
import org.hibernate.annotations.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Description
 * @Author Spark
 * @Date Created in (2019/11/09 12:22)
 * @Version v1.0
 * @Modify
 **/
@Entity(name="parking_contract")
@Table(appliesTo = "parking_contract",comment = "车位合同")
@Data
@EntityListeners(AuditingEntityListener.class)
public class ParkingContract extends BaseEntity {

    @Column(name = "community_id", columnDefinition = "BIGINT COMMENT '客户ID'")
    @NotNull(message = "社区未关联")
    private Long communityId;

    @Column(name = "cust_id", columnDefinition = "BIGINT COMMENT '客户ID'")
    @NotNull(message = "客户未关联")
    private Long custId;

    @Column(name = "parking_id", columnDefinition = "BIGINT COMMENT '车位ID'")
    @NotNull(message = "车位未关联")
    private Long parkingId;

    @Column(name = "quote_id", columnDefinition = "BIGINT COMMENT '报价ID'")
    @NotNull(message = "报价未关联")
    private Long quoteId;

    @Column(name = "quote_type", columnDefinition = "INT COMMENT '报价类型'")
    @NotNull(message = "报价类型不能为空")
    private Integer quoteType;

    @Column(name = "quote_range", columnDefinition = "INT COMMENT '报价周期'")
    @NotNull(message = "报价周期不能为空")
    private Integer quoteRange;

    @Column(name = "quote_unit", columnDefinition = "INT COMMENT '报价周期单位'")
    @NotNull(message = "报价周期单位不能为空")
    private Integer quoteUnit;

    @Column(name = "quote_price", columnDefinition = "DOUBLE(8,2) COMMENT '报价'")
    @NotNull(message = "报价不能为空")
    private Double quotePrice;

    /*@Column(name = "real_range", columnDefinition = "INT COMMENT '合同周期'")
    @NotNull(message = "合同周期不能为空")
    private Integer realRange;*/

    @Column(name = "real_price", columnDefinition = "DOUBLE(8,2) COMMENT '合同金额'")
    @NotNull(message = "合同金额不能为空")
    private Double realPrice;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "sign_date", columnDefinition = "DATETIME COMMENT '签订日期'")
    @NotNull(message = "签订日期不能为空")
    private Date signDate;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "start_date", columnDefinition = "DATETIME COMMENT '开始日期'")
    @NotNull(message = "开始日期不能为空")
    private Date startDate;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "end_date", columnDefinition = "DATETIME COMMENT '结束日期'")
    @NotNull(message = "结束日期不能为空")
    private Date endDate;

    @Column(name = "contract_file_id", columnDefinition = "BIGINT COMMENT '合同文件ID'")
    @NotNull(message = "合同文件未关联")
    private Long contractFileId;
}
